var car_series_id = 0; //车系id
$(document).ready(function() {
			//自己代码
			get_user_mess_and_token();
			/* http://127.0.0.1:8899/html/car_series_article.html?1    */
			var url = location.search;
			car_series_id = url.substr(1); //车系id
			//查询全部文章
			series_article_id();
			//加载品牌和车系名称
			serice_brand();
			//文章排行榜
			information_ranking();

});

function series_article_id(){
	$.get(path+"InformationController/seleCarSeriesInformation/"+car_series_id+"",function(data){
		var series_str="";
		$(data).each(function(index,item){
			series_str+="<li>"+
							"<div class='common-card_wrapper__Inr_n '>"+
								"<div>"+
									"<div class='tw-relative tw-text-common-black' style='font-size:0'>"+
										"<a title='"+item.information_title+"' href='http://127.0.0.1:8899/html/car_information_details.html?"+item.information_id+"/"+car_series_id+"' target='_blank' class='jsx-1095092229'>"+
											"<div style='display:block;overflow:hidden;position:relative;z-index:0' class='tw-rounded-4 g-load-img-wrap'>"+
												"<div style='display:block;box-sizing:border-box;padding-top:56.00000000000001%'></div>"+
												"<img src='"+imagePath+item.information_images.information_images_1+"'"+
												"alt='"+item.information_title+"' width='250' height='140' style='position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover'"+
												"class='zoom' />"+
											"</div>"+
										"</a>"+	
										"<div class='jsx-1904556275 author-avatar_avatar-wrap__1pWQN'>"+
											"<div class='jsx-2217341492 avatar_avatar-img__170Bh tw-text-0'>"+
												"<a href='http://127.0.0.1:8899/html/car_my_homepage.html?"+item.user.user_id+"' title='"+item.user.user_name+"主页' target='_blank'>"+
													"<div style='display:inline-block;max-width:100%;overflow:hidden;position:relative;z-index:0' class='avatar tw-rounded-full'>"+
														"<div style=\"box-sizing:border-box;display:block;max-width:100%\">"+
															"<img style='max-width:100%;display:block;margin:0;border:none;padding:0'"+
															" src='data:image/svg+xml;utf-8,&lt;svg width=&quot;40&quot; height=&quot;40&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot;/&gt;'"+
															" aria-hidden='true' role='presentation' />"+
														"</div><noscript>"+
															"<img src='"+imagePath+item.user.user_head_portrait_url+"'"+
															"alt='"+item.user.user_name+"头像' width='40' height='40' style='position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover'"+
															"class='' /></noscript>" +
															"<img src='"+imagePath+item.user.user_head_portrait_url+"'"+
															 "alt='"+item.user.user_name+"头像' width='40' height='40' style='position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover'"+
															 "class='' />"+
													"</div>"+
													"<i class='jsx-2217341492 avatar_author-v__2Xocb author-v v-yellow'></i>"+
												"</a>"+
											"</div>"+
											"<p title='有车以后' class='jsx-1904556275 author-avatar_name__3ex3- name line-1'>" +
												"<a href='http://127.0.0.1:8899/html/car_my_homepage.html?"+item.user.user_id+"' title='"+item.user.user_name+"主页' target='_blank'>"+item.user.user_name+"</a>"+
											"</p>"+	
										"</div>"+
									"</div>"+	
									"<h3 class='tw-leading-22 tw-text-16 tw-font-medium tw-text-common-black tw-text-justify line-2 g-active-link-text tw-mt-36'>"+
										"<a title='"+item.information_title+"' href='http://127.0.0.1:8899/html/car_information_details.html?"+item.information_id+"/"+car_series_id+"' target='_blank' class='jsx-1095092229'>"+item.information_title+"</a>"+
									"</h3>"+
									"<p class='tw-mt-8 tw-h-20 tw-lead tw-text-common-gray tw-text-14'>"+
										"<a title='"+item.information_title+"' href='http://127.0.0.1:8899/html/car_information_details.html?"+item.information_id+"/"+car_series_id+"' target='_blank' class='jsx-1095092229'>"+
											"<span class='tw-mr-8'>"+item.information_read_count+"<!-- -->次<!-- -->阅读</span>"+
											"<span>"+item.information_release_date+"</span>"+
										"</a>"+
									"</p>"+
								"</div>"+
							"</div>"+
						"</li>"
		});
		$("#Car_series_li li").remove();
		$("#Car_series_li").append(series_str);
	},"json")
}

function serice_brand(){
	$.get(path+"Car_seriesController/select_series_id_brand/"+car_series_id+"",function(data){
		var str="<span class='breadcrumb_pos__-mebC'>当前位置：</span>" +
				"<span class='pos-item icon'>"+
					"<a target='_blank' href='http://127.0.0.1:8899/html/car_vehicle_selection.html'>选车</a>"+
				"</span>"+
				"<span class='pos-item icon icon-arrow-ic-r'>"+
					"<a target='_blank' href='http://127.0.0.1:8899/html/car_vehicle_selection.html?"+data.brand.brand_id+","+data.brand.brand_name+"-x-x-x-x-x-x'>"+data.brand.brand_name+"</a>"+
				"</span>"+
				"<span class='pos-item icon icon-arrow-ic-r'>"+
					"<a target='_blank' href='http://127.0.0.1:8899/html/car_series_index.html?"+data.car_series_id+"'>"+data.car_series_name+"</a>"+
				"</span>"+
				"<span class='pos-item icon-arrow-ic-r'>文章</span>"
		
		$("#series_brand span").remove();
		$("#series_brand").append(str);
		$("#tui_series").html(data.car_series_name+"<span class='tw-mx-4'>·</span>");
		
		//标题路径
		tite_li(data.brand.brand_id);
		
	},"json")
}
//文章排行榜
function information_ranking(){
	$.get(path+"InformationController/tenInfoAll",function(data){
		var str="";
			$(data).each(function(index,item){
				if(index>7){
					str+="";
				}else{
					str+="<li class='jsx-1989576384'>"+
							"<a href='http://127.0.0.1:8899/html/car_information_details.html?"+item.information_id+"/"+car_series_id+"' target='_blank' class='jsx-1989576384' rel='opener'>"+
								"<div class='jsx-1989576384 tw-group tw-flex tw-pr-16 tw-py-14 tw-border-b-1 tw-border-color-gray-400'>"+
									"<div class='jsx-1989576384 tw-ml-8 tw-mr-12 rank-icon-bg right-rank_rank-icon__1OkkZ right-rank_rank-1__2LSAG' style='background-position: 0 -"+(index*35)+"px;'></div>"+
									"<div class='jsx-1989576384 tw-flex-1'>"+
										"<div title='"+item.information_title+"' class='jsx-1989576384 tw-text-14 xl:tw-text-16 tw-leading-22 xl:tw-leading-24 tw-font-semibold tw-text-common-black group-hover:tw-text-color-orange-500 right-rank_line-camp-2__3akIB right-rank_transition-color-20__3VOFe'>"+item.information_title+"</div>"+
											"<div class='jsx-1989576384 tw-flex tw-items-center tw-pt-4 tw-pb-2'>"+
												"<div class='jsx-1989576384 tw-text-14 tw-leading-22 tw-text-common-gray'>"+item.information_read_count+"<!-- -->次<!-- -->阅读</div>"+
											"</div>"+
									"</div>"+
								"</div>"+
							"</a>"+
						"</li>"
				}
			})
			$("#series_information_ranking li").remove();
			$("#series_information_ranking").append(str);
			
	},'json')
}

//标题路径
function tite_li(brand_xx){
	$(".top-nav_nav__SVtcl li:eq(0)>a").attr("href","http://127.0.0.1:8899/html/car_series_index.html?"+ car_series_id);
	$(".top-nav_nav__SVtcl li:eq(1)>a").attr("href","http://127.0.0.1:8899/html/car_actual_large_picture.html?"+ car_series_id+"/"+brand_xx);
	$(".top-nav_nav__SVtcl li:eq(2)>a").attr("href","http://127.0.0.1:8899/html/car_series_article.html?"+car_series_id);
	$(".top-nav_nav__SVtcl li:eq(3)>a").attr("href","http://127.0.0.1:8899/html/car_series_video.html?"+car_series_id);
	//登录
	$("#login_button>a").attr("href","http://127.0.0.1:8899/html/car_login.html?car_series_article/"+car_series_id+"");
}
